Functions
Image Processing

Includes APIs for displaying images, saving images, and converting pixel format. More...

Functions

def MV_CC_SaveImageEx3 (self, stSaveParam)
 Saves images, supporting BMP and JPEG. More...
 
def MV_CC_SaveImageToFileEx (self, pstSaveFileParam)
 Saves images to files. More...
 
def MV_CC_SaveImageToFileEx2 (self, pstImage, pSaveImageParam, pcImagePath)
 Saves images to files. More...
 
def MV_CC_RotateImage (self, stRotateParam)
 Rotates images. More...
 
def MV_CC_FlipImage (self, pstFlipParam)
 Flips images. More...
 
def MV_CC_ConvertPixelTypeEx (self, pstCvtParam)
 Converts pixel format. More...
 
def MV_CC_SetBayerCvtQuality (self, nBayerCvtQuality)
 Sets the interpolation method of Bayer format. More...
 
def MV_CC_SetBayerFilterEnable (self, bFilterEnable)
 Enables or disables the smoothing function of interpolation algorithm. More...
 
def MV_CC_SetBayerGammaValue (self, fBayerGammaValue)
 Sets the Gamma value in Bayer pattern. More...
 
def MV_CC_SetGammaValue (self, enSrcPixelType, fGammaValue)
 Sets Gamma value in Mono 8 or Bayer 8/10/12/16 pattern. More...
 
def MV_CC_SetBayerGammaParam (self, stGammaParam)
 Sets Gamma information in Bayer pattern. More...
 
def MV_CC_SetBayerCCMParam (self, stCCMParam)
 Enables/disables CCM and sets CCM parameters in Bayer pattern. More...
 
def MV_CC_SetBayerCCMParamEx (self, stCCMParam)
 Enables/disables CCM and sets CCM parameters in Bayer pattern (extended API). More...
 
def MV_CC_ImageContrast (self, stConstrastParam)
 Adjusts image contrast. More...
 
def MV_CC_PurpleFringing (self, pstPurpleFringingParam)
 Corrects purple fringing of the image. More...
 
def MV_CC_HBDecode (self, stDecodeParam)
 Decodes lossless compression stream into raw data. More...
 
def MV_CC_StartRecord (self, stRecordParam)
 Starts recording. More...
 
def MV_CC_InputOneFrame (self, stInputFrameInfo)
 Inputs raw data for recording. More...
 
def MV_CC_InputOneFrameEx (self, stInputFrameInfo)
 Input RAW data to Record. More...
 
def MV_CC_StopRecord (self)
 Stops recording. More...
 
def MV_CC_ReconstructImage (self, stReconstructParam)
 Reconstructs the image for multi-light control. More...
 

Detailed Description

Includes APIs for displaying images, saving images, and converting pixel format.

Function Documentation

◆ MV_CC_SaveImageEx3()

def MvCameraControl_class.MV_CC_SaveImageEx3 (   self,
  stSaveParam 
)

Saves images, supporting BMP and JPEG.

Parameters
handle[IN] It refers to the device handle.
pstSaveParam[IN][OUT] It refers to the structure of image saving parameters.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
  • Call this API to convert the original images grabbed by the device into JPEG or BMP format and save them in the specified memory. You can then save the converted data as image files.
  • This API requires no specific calling sequence. The conversion will be executed when there is any image data. You can call MV_CC_GetOneFrameTimeout() or MV_CC_RegisterImageCallBackEx() to set the callback function and get one image frame, then call this API to convert the format.
  • The maximum supported image width, height, length by this API are UNIT_MAX.
  • The maximum supported image width, height, length by MV_CC_SaveImageEx2() are USHRT_MAX.
  • The maximum supported image width and height in JPEG format are 65500.

◆ MV_CC_SaveImageToFileEx()

def MvCameraControl_class.MV_CC_SaveImageToFileEx (   self,
  pstSaveFileParam 
)

Saves images to files.

Parameters
handle[IN] It refers to the device handle.
pstSaveFileParam[IN][OUT] It refers to the structure of image file saving parameters.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
  • This API supports BMP, JPEG, PNG, and TIFF.
  • The maximum supported image width, height, length by this API are UINT_MAX.
  • The maximum supported image width and height in JPEG format are 65500.
  • In Linux operating system, the file path should be withing 255 bytes.

◆ MV_CC_SaveImageToFileEx2()

def MvCameraControl_class.MV_CC_SaveImageToFileEx2 (   self,
  pstImage,
  pSaveImageParam,
  pcImagePath 
)

Saves images to files.

Parameters
handle[IN] It refers to the device handle.
pstImage[IN] It refers to the image information.
pSaveImageParam[IN] It refers to the image saving parameter.
pcImagePath[IN] It refers to the image saving path.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
  • This API supports saving images over 4 GB in PNG and TIFF formats, and images less than 4 GB in BMP, JPEG, TIFF, and PNG formats.
  • The maximum supported image width and height in JPEG format are 65500.
  • In Linux operating system, the file path should be withing 255 bytes.

◆ MV_CC_RotateImage()

def MvCameraControl_class.MV_CC_RotateImage (   self,
  stRotateParam 
)

Rotates images.

Parameters
handle[IN] It refers to the device handle.
pstRotateParam[IN][OUT] It refers to the structure of image rotation parameters.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
This API only supports 90°, 180°, and 270° rotation of images in Mono 8, RGB24, and BGR24 formats.

◆ MV_CC_FlipImage()

def MvCameraControl_class.MV_CC_FlipImage (   self,
  pstFlipParam 
)

Flips images.

Parameters
handle[IN] It refers to the device handle.
pstFlipParam[IN][OUT] It refers to the structure of image flipping parameters.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
This API only supports vertical and horizontal flipping of images in Mono 8, RGB24, and BGR24 formats.

◆ MV_CC_ConvertPixelTypeEx()

def MvCameraControl_class.MV_CC_ConvertPixelTypeEx (   self,
  pstCvtParam 
)

Converts pixel format.

Parameters
handle[IN] It refers to the device handle.
pstCvtParam[IN][OUT] It refers to the structure of pixel format conversion parameters.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
  • Call this API to convert the collected original images to images in required pixel format and save them to specified memory.
  • This API requires no specific calling sequence. The conversion will be executed when there is any image data. You can call MV_CC_GetOneFrameTimeout() or MV_CC_RegisterImageCallBackEx() to set the callback function and get one image frame, then call this API to convert the format. If the collected image is in compressed JPEG format, it cannot be converted via this API.
  • The maximum supported image width, height, length by this API are UNIT_MAX.
  • The maximum supported image width, height, length by MV_CC_ConvertPixelType() are USHRT_MAX.
  • Supported pixel formats for conversion are shown below. Column 1 is the input pixel formats, and Row 1 is the output pixel formats. "√" in the table means the pixel format can be converted, and "×" means the pixel format cannot be converted.
    Output Format / Input Format Mono8 RGB24 BGR24 RGB Planar YUV422 YUV422 YUYV
    Mono8
    Mono10
    Mono10P
    Mono12
    Mono12P
    BayerGR8
    BayerRG8
    BayerGB8
    BayerBG8
    BayerRBGG8
    BayerBRGG8
    BayerGR10
    BayerRG10
    BayerGB10
    BayerBG10
    BayerGR12
    BayerRG12
    BayerGB12
    BayerBG12
    BayerGR10P
    BayerRG10P
    BayerGB10P
    BayerBG10P
    BayerGR12P
    BayerRG12P
    BayerGB12P
    BayerBG12P
    RGB8P
    BGR8P
    YUV422P
    YUV422 YUYV

◆ MV_CC_SetBayerCvtQuality()

def MvCameraControl_class.MV_CC_SetBayerCvtQuality (   self,
  nBayerCvtQuality 
)

Sets the interpolation method of Bayer format.

Parameters
handle[IN] It refers to the device handle.
nBayerCvtQuality[IN] It refers to the interpolation method. 0: fast, 1: equilibrated (default), 2: optimal, 3: optimal plus.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
Call this API to set the Bayer interpolation algorithm type parameter for the APIs: MV_CC_ConvertPixelTypeEx() , MV_CC_GetImageForRGB() , and MV_CC_GetImageForBGR() .

◆ MV_CC_SetBayerFilterEnable()

def MvCameraControl_class.MV_CC_SetBayerFilterEnable (   self,
  bFilterEnable 
)

Enables or disables the smoothing function of interpolation algorithm.

Parameters
handle[IN] It refers to the device handle.
bFilterEnable[IN] Whether to enable the smoothing function of interpolation algorithm (disabled by default).
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
Call this API to enable or disable the smoothing function of Bayer interpolation, and it determines the interpolation algorithm of the APIs MV_CC_ConvertPixelTypeEx(), MV_CC_SaveImageEx3(), and MV_CC_SaveImageToFileEx().

◆ MV_CC_SetBayerGammaValue()

def MvCameraControl_class.MV_CC_SetBayerGammaValue (   self,
  fBayerGammaValue 
)

Sets the Gamma value in Bayer pattern.

Parameters
handle[IN] It refers to the device handle.
fBayerGammaValue[IN] It refers to the Gamma value, range: [0.1, 4.0].
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
The Gamma value set by this API will be used when calling MV_CC_ConvertPixelTypeEx() , MV_CC_SaveImageEx3() , or MV_CC_SaveImageToFileEx() to convert Bayer 8/10/12/16 format to RGB 24/48, RGBA 32/64, BGR 24/48, or BGRA 32/64.

◆ MV_CC_SetGammaValue()

def MvCameraControl_class.MV_CC_SetGammaValue (   self,
  enSrcPixelType,
  fGammaValue 
)

Sets Gamma value in Mono 8 or Bayer 8/10/12/16 pattern.

Parameters
handle[IN] It refers to the device handle.
MvGvspPixelTypeenSrcPixelType [IN] It refers to the pixel format. Supports PixelType_Gvsp_Mono8 and Bayer 8/10/12/16.
fGammaValue[IN] It refers to the Gamma value, range: [0.1, 4.0].
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks

◆ MV_CC_SetBayerGammaParam()

def MvCameraControl_class.MV_CC_SetBayerGammaParam (   self,
  stGammaParam 
)

Sets Gamma information in Bayer pattern.

Parameters
handle[IN] It refers to the device handle.
pstGammaParam[IN] It refers to the Gamma information.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
The Gamma information set via this API will be used when MV_CC_ConvertPixelTypeEx() , MV_CC_SaveImageEx3() , or MV_CC_SaveImageToFileEx() is called to convert Bayer 8/10/12/16 format to RGB 24/48, RGBA 32/64, BGR 24/48, or BGRA 32/64.

◆ MV_CC_SetBayerCCMParam()

def MvCameraControl_class.MV_CC_SetBayerCCMParam (   self,
  stCCMParam 
)

Enables/disables CCM and sets CCM parameters in Bayer pattern.

The default quantitative scale is 1024.

Parameters
handle[IN] It refers to the device handle.
pstCCMParam[IN] It refers to CCM parameter.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
After the API is called to enable CCM and set the CCM, the CCM parameters will take effect when MV_CC_ConvertPixelTypeEx(), MV_CC_SaveImageEx3(), or MV_CC_SaveImageToFileEx is called to convert Bayer 8/10/12/16 format to RGB 24/48, RGBA 32/64, BGR 24/48, or BGRA 32/64.

◆ MV_CC_SetBayerCCMParamEx()

def MvCameraControl_class.MV_CC_SetBayerCCMParamEx (   self,
  stCCMParam 
)

Enables/disables CCM and sets CCM parameters in Bayer pattern (extended API).

Parameters
handle[IN] It refers to the device handle.
pstCCMParam[IN] It refers to CCM parameter.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
After the API is called to enable CCM and set the CCM, the CCM parameters will take effect when MV_CC_ConvertPixelTypeEx() or MV_CC_SaveImageEx3() is called to convert Bayer 8/10/12/16 format to RGB 24/48, RGBA 32/64, BGR 24/48, or BGRA 32/64.

◆ MV_CC_ImageContrast()

def MvCameraControl_class.MV_CC_ImageContrast (   self,
  stConstrastParam 
)

Adjusts image contrast.

Parameters
handle[IN] It refers to the device handle.
pstContrastParam[IN][OUT] It refers to the contrast parameter structure.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.

◆ MV_CC_PurpleFringing()

def MvCameraControl_class.MV_CC_PurpleFringing (   self,
  pstPurpleFringingParam 
)

Corrects purple fringing of the image.

Parameters
handle[IN] It refers to the device handle.
pstPurpleFringingParam[IN][OUT] It refers to the purple fringing correction parameter.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
This API only supports processing images in PixelType_Gvsp_RGB8_Packed and PixelType_Gvsp_BGR8_Packed formats.

◆ MV_CC_HBDecode()

def MvCameraControl_class.MV_CC_HBDecode (   self,
  stDecodeParam 
)

Decodes lossless compression stream into raw data.

Parameters
handle[IN] It refers to the device handle.
pstDecodeParam[IN][OUT] It refers to the structure of lossless decoding parameters.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
  • Call this API to decode the lossless compression stream of camera to raw data, and parse the watermark of real-time images of the current camera. If the inputted lossless stream is not real-time or does not belong to the current camera, an exception may occur during watermark parsing.
  • If the decoding failed, check if it is one of the following circumstances:
    (1) CPU does not support SSE AVX instruction set.
    (2) Exception occurred on the current frame (e.g., packet loss).
    (3) Exception occurred on image generating from camera, even without packet loss.

◆ MV_CC_StartRecord()

def MvCameraControl_class.MV_CC_StartRecord (   self,
  stRecordParam 
)

Starts recording.

Parameters
handle[IN] It refers to the device handle.
pstRecordParam[IN] It refers to the recording parameter structure.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure. The maximum supported width × height is 8192 × 8192, and the minimum supported is 96 × 96. If the value exceeds, an error will occur when calling MV_CC_InputOneFrame().

◆ MV_CC_InputOneFrame()

def MvCameraControl_class.MV_CC_InputOneFrame (   self,
  stInputFrameInfo 
)

Inputs raw data for recording.

Parameters
handle[IN] It refers to the device handle.
pstInputFrameInfo[IN] It refers to the record data structure.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
Input of HB and JPEG files is not supported, and they should be decoded first.

◆ MV_CC_InputOneFrameEx()

def MvCameraControl_class.MV_CC_InputOneFrameEx (   self,
  stInputFrameInfo 
)

Input RAW data to Record.

Parameters
handle[IN] Device handle
pstInputFrameInfo[IN] Record data structure
Returns
Success, return MV_OK. Failure, return error code
Remarks
Direct input of HB and JPEG is supported, with decoding handled internally by the SDK.

◆ MV_CC_StopRecord()

def MvCameraControl_class.MV_CC_StopRecord (   self)

Stops recording.

Parameters
handle[IN] It refers to the device handle.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.

◆ MV_CC_ReconstructImage()

def MvCameraControl_class.MV_CC_ReconstructImage (   self,
  stReconstructParam 
)

Reconstructs the image for multi-light control.

Parameters
handle[IN] It refers to the device handle.
pstReconstructParam[IN][OUT] It refers to the image reconstruction parameter.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
  • It supports reconstructuring images with different exposure values to one image, used with MultiLightControl node of line scan camera. If MultiLightControl node value is 2, it means 2 images with different exposure values will be reconstructed to one image (with height as the sum of two images). In the meantime, if this API is called and nExposureNum value is set as 2, the above reconstructed image will be later divided to 2 images with two specified exposure values.
  • If line scan camera is not used or MultiLightControl node of line scan camera is disabled, and nExposureNum value is set as n, the image reconstructing function will not work. The image will be divided into n images by line, each of them with the height 1/n of the original image.